package com.guigu.eduservice.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.guigu.common.utils.R;
import com.guigu.eduservice.entity.EquipmentImage;
import com.guigu.eduservice.service.EquipmentImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 设备图片表（存储设备的展示图片，最多25张） 前端控制器
 * </p>
 *
 * @author Xiaosong
 * @since 2025-10-11
 */
@RestController
@RequestMapping("/advertisement/equipmentImage")
public class EquipmentImageController {
    @Autowired
    private EquipmentImageService equipmentImageService;
    //根据id查询非封面图片
    @GetMapping("/{equipmentId}/image")
    public R getImage(@PathVariable Long equipmentId){
        System.out.println("进入设备图片页面"+ equipmentId);
        QueryWrapper<EquipmentImage> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("equipment_id",equipmentId).ne("is_cover",1);
        List<EquipmentImage> list = equipmentImageService.list(queryWrapper);
        return R.ok().data("list",list);
    }
}
